let request = require('../../utils/request.js')
Page({
  data: {
    postlist:{},
    cardId:''
  },
  //充值卡充值
  sendData(){
    my.navigateTo({
      url: '../scanRecharge/index?cardId=' + this.data.cardId,
    })
  },
  cardId_input(e) {
    this.data.cardId = e.detail.value
    this.setData({
      cardId: this.data.cardId
    });
    my.setStorageSync({
      key: 'cardId',
      data: this.data.cardId
    });
    // my.setStorageSync("cardId", this.data.cardId)//写入缓存 
    //my.getStorageSync({ key: 'cardId' });
  },
  onLoad() {
    my.getNetworkType({
      success: (res) => {
        if (!res.networkAvailable || res.networkType == 'UNKNOWN') {
          my.showToast({
            content: '网络状态不佳，请检查网络',
            type: 'fail',
            duration: 2000
          })
        }
      }
    })
  },
  onShow(){
    let value = my.getStorageSync({ key: 'cardId' })
    if (value) {
      this.data.cardId = value.data
    }
    this.setData({
      cardId: this.data.cardId
    })
  }
})
